<?php

if ( ! class_exists( 'Avala' ) ):

class Avala {
	public function __construct() {
		add_action( 'after_theme_setup', array($this, 'themeSetup') );
		add_action( 'widgets_init', array($this, 'widgetInit' ) );
		if (!is_admin()) {
			add_action( 'wp_print_styles', array($this, 'loadStyle') );
		}
	}
	
	public function widgetInit() {
		//Side language
		register_sidebar( array(
			'name' => __( 'Language switcher sidebar', 'avala' ),
			'class' => 'list-languges',
			'id' => 'language-sidebar',
			'description' => __( 'The fourth footer widget area', 'avala' ),
			'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
			'after_widget' => '</li>',
			'before_title' => '<h3 class="widget-title">',
			'after_title' => '</h3>',
		) );
		//Customer Service
		register_sidebar( array(
			'name' => __( 'Customer Service', 'avala' ),
			'class' => 'customer-service',
			'id' => 'customer-service',
			'description' => __( 'Sidebar display customer service infomation', 'avala' ),
			'before_widget' => '<div id="%1$s" class="block-content %2$s">',
			'after_widget' => '</div>',
			'before_title' => '<h2 class="title"><img class="ui-general init-general4" src="'. get_bloginfo('template_url') .'/images/transparent.png" alt=""/><span class="left">',
			'after_title' => '</span></h2>',
		) );
		//Company Service
		register_sidebar( array(
			'name' => __( 'Company Service', 'avala' ),
			'class' => 'company-service',
			'id' => 'company-service',
			'description' => __( 'Sidebar display company service infomation', 'avala' ),
			'before_widget' => '<div id="%1$s" class="block-content %2$s">',
			'after_widget' => '</div>',
			'before_title' => '<h2 class="title"><img class="ui-general init-general7" src="'. get_bloginfo('template_url') .'/images/transparent.png" alt=""/><span class="left">',
			'after_title' => '</span></h2>',
		) );
	}
	
	public function themeSetup() {
		// This theme styles the visual editor with editor-style.css to match the theme style.
		add_editor_style();

		// Post Format support. You can also use the legacy "gallery" or "asides" (note the plural) categories.
		add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );

		// This theme uses post thumbnails
		add_theme_support( 'post-thumbnails' );

		// Add default posts and comments RSS feed links to head
		add_theme_support( 'automatic-feed-links' );
		
		//Add custom image size
		add_image_size('tiny-thumb', 71, 0);

		// Make theme available for translation
		// Translations can be filed in the /languages/ directory
		load_theme_textdomain( 'avala', get_template_directory() . '/languages' );

		// This theme uses wp_nav_menu() in one location.
		register_nav_menus( array(
			'primary' => __( 'Primary Navigation', 'twentyten' ),
		) );
	}
	
	public function loadStyle() {
		wp_enqueue_style( 'screen', get_bloginfo('template_url') . '/css/screen.css', array(), false, 'screen');
		wp_enqueue_style( 'print', get_bloginfo('template_url') . '/css/print.css', array(), false, 'print');
	}
}

$avala = new Avala();
endif;
